<template>
  <div>
    <som :ss="arr" @shu="ck2"></som>
    {{ arr }}
    <table>
      <thead>
        <tr>
          <td>id</td>
          <td>姓名</td>
        </tr>
        <tr v-for="ccc in obj" :key="ccc.id" v-focus>
          <td @click="ck(ccc.id)">{{ ccc.id }}</td>
          <td @click="ck(ccc.name)">{{ ccc.name }}</td>
        </tr>
      </thead>
    </table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      arr: [1, 2],
      obj: [
        { id: "1", name: "张三" },
        { id: "2", name: "陈家旺" },
      ],
    };
  },
  mounted(){
    // this.$on('shu',(val)=>{
    //   console.log(val);
    //   this.arr=val
    // })
  },
  created() {
    // this.$on('shu',(val)=>{
    //   console.log(val);
    //   this.arr=val
    // })
  },
  components: {
    'som': som
  },
  computed: {},
  methods: {
    ck2(val){
      console.log(1);
      this.arr=val
    },
    ck(val) {
      alert(val);
      console.log(val);
    },
  },
};
</script>
<style scoped>
</style>